//
//  SNSearchHistoryManager.m
//  ZhuoxinAgriculture
//
//  Created by stone on 16/12/22.
//  Copyright © 2016年 stone. All rights reserved.
//

#import "SNSearchHistoryManager.h"

@interface SNSearchHistoryManager()

@end

@implementation SNSearchHistoryManager

+ (instancetype)sharedManager{
    static id _instance;
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        _instance = [[self alloc] init];
    });
    
    return _instance;
}
- (instancetype)init
{
    self = [super init];
    if (self) {
        self.searchHistoryModels = [SNSearchHistoryModel findAll].mutableCopy;
    }
    return self;
}
- (void)addObject:(SNSearchHistoryModel *)model{
    
    [self.searchHistoryModels addObject:model];
    
    dispatch_async(dispatch_get_global_queue(0, 0), ^{
        [model save];
    });
    
}
- (void)deleteObject:(SNSearchHistoryModel *)model{
    
}
@end
